﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Data.SqlClient;
using System.Data;
using System.Collections;

using XJX.DataLayer;

namespace XJX.BusinessLayer
{
    public class Admin
    {
        private string ConnToData;

        public Admin(string newConnectionString)
        {
            ConnToData = newConnectionString;
        }

        //
        public DataTable Ad_Search_Book_From_BID(string BID, out int r)
        {
            DataTable dt = new DataTable();

            DataSet ds = new XJX.DataLayer.Admin(ConnToData).Ad_Search_Book_From_BID(BID,"Borrow_Info",out r);
            dt = ds.Tables[0];

            return dt;
        }

        //获得确认表，准备导出确认表。
        public DataTable Get_Admin_Confirm_Yes_List()
        {
            DataTable dt = new DataTable();

            DataSet ds = new XJX.DataLayer.Admin(ConnToData).Get_Admin_Confirm_Yes_List("Confirm_Table_Info");
            dt = ds.Tables[0];

            return dt;
        }


        public int Confirm_One_Book_Arrived(string ID)
        {
            int r = 0;

            try
            {
                r = new XJX.DataLayer.Admin(ConnToData).Confirm_One_Book_Arrived(ID);
            }
            catch (SqlException e)
            {
                throw new System.Exception(e.Message);
            }

            return r;
        }

        public int Ad_Clear_Confirm_Table_Info()
        {
            int r = 0;

            try
            {
                r = new XJX.DataLayer.Admin(ConnToData).Ad_Clear_Confirm_Table_Info();
            }
            catch (SqlException e)
            {
                throw new System.Exception(e.Message);
            }

            return r;
        }

        //验证管理员登录
        public int Ad_Verification_User_Log
            (
            string mobile,
            string pwd,
            out string ReturnFieldValue
            )
        {
            int i;

            try
            {
                i = new XJX.DataLayer.Admin(ConnToData).Ad_Verification_User_Log(mobile, pwd,out ReturnFieldValue);
            }
            catch (SqlException e)
            {
                throw new System.Exception(e.Message);
            }
            return i;
        }

        //获取管理员信息
        public DataTable Ad_2_Get_Admin_Info(string schoolID)
        {
            DataTable dt = new DataTable();

            DataSet ds = new XJX.DataLayer.Admin(ConnToData).Ad_2_Get_Admin_Info(schoolID);
            dt = ds.Tables[0];

            return dt;
        }


    }
}
